With rapid development of a social network, the World Wide Web, a telecommunications network, and the like, organization and query technologies based on graph data have emerged. When a data volume is relatively large, graph data may also be referred to as big graph data.
A set of graph data may be referred to as a graph data whole set, where the graph data whole set generally includes multiple vertices and an edge between every two vertices that have a connection relationship. According to an actual application scenario, a vertex may represent a corresponding physical meaning. For example, in a social network, a vertex represents a user; graph data of a vertex may include various attribute data of a user represented by the vertex, such as a name, a gender, an age, a friend list, and the like; for two vertices that have a connection relationship, an edge is created between the two vertices, and the edge may indicate that users represented by the two vertices are friends. For another example, in a map, a vertex may represent a geographical location; graph data of a vertex may include various attribute data of a geographical location represented by the vertex, such as a location name, location coordinates, and the like; for two vertices that have a connection relationship, an edge is created between the two vertices, and the edge may indicate that there is a direct path between geographical locations represented by the two vertices, that is, one vertex may be connected from the other vertex without passing through another vertex.
In actual application of graph data, the graph data often needs to be queried to acquire expected graph data. For example, in a social network, related graph data of a specified user may be queried, or a user that has a friend relationship with a specified user may be queried according to a query condition. For another example, in a map, a shortest path between two geographical locations may be queried.
However, as a data volume of a graph data whole set grows, query efficiency decreases because each graph data query is based on all graph data included in the graph data whole set.
To improve query efficiency, some solutions to organizing graph data have emerged in the prior art. In these solutions, a partitioning algorithm is generally used to organize graph data, that is, all graph data in a graph data whole set is divided into multiple partitions for separate storage and calculation.
However, even though partitioning is performed on graph data, for some query requirements, for example, a distance related query requirement, query still needs to be performed based on a graph data whole set, so as to ensure accuracy of a query result. In this case, a problem of relatively low query efficiency still exists.